package com.laex;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.lcdui.ItemCommandListener;

public class MenuManager extends Form  {

	private Command categoryEntryCMD;
	private Command expenseEntryCMD;
	private Command reportViewCMD;
	private Command expenseSummaryCMD;
	private Command deleteAllCategoriesCMD;
	private Command deleteAllExpenseCMD;
	private Command pieChartCMD;
	
	
	private ImageItem categoryImg;
	private ImageItem expenseImg;
	private ImageItem reportImg;
	private ImageItem expenseSummaryImg;
	private ImageItem deleteAllCategoriesImg;
	private ImageItem deleteAllExpenseImg;
	private ImageItem pieChartIMG;
	
	public MenuManager(ItemCommandListener handler) {
		super("Laexian POE");
		
		categoryEntryCMD = new Command("Add", Command.ITEM, 1);
		expenseEntryCMD = new Command("Add", Command.ITEM, 2);
		reportViewCMD = new Command("View", Command.ITEM, 3);
		expenseSummaryCMD = new Command("View", Command.ITEM, 4);
		deleteAllCategoriesCMD = new Command("GO", Command.ITEM, 5);
		deleteAllExpenseCMD = new Command("GO", Command.ITEM, 6);
		pieChartCMD = new Command("View", Command.ITEM, 6);
		

		categoryImg = POEUtil.getPlusIcon();
		expenseImg = POEUtil.getPlusIcon();
		reportImg = POEUtil.getReportIcon();
		expenseSummaryImg = POEUtil.getExpenseReportIcon();
		deleteAllCategoriesImg = POEUtil.getDeleteIcon();
		deleteAllExpenseImg = POEUtil.getDeleteIcon();
		pieChartIMG = POEUtil.getChartIcon();

		categoryImg.addCommand(categoryEntryCMD);
		expenseImg.addCommand(expenseEntryCMD);
		reportImg.addCommand(reportViewCMD);
		expenseSummaryImg.addCommand(expenseSummaryCMD);
		deleteAllCategoriesImg.addCommand(deleteAllCategoriesCMD);
		deleteAllExpenseImg.addCommand(deleteAllExpenseCMD);
		pieChartIMG.addCommand(pieChartCMD);

		categoryImg.setItemCommandListener(handler);
		expenseImg.setItemCommandListener(handler);
		reportImg.setItemCommandListener(handler);
		expenseSummaryImg.setItemCommandListener(handler);
		deleteAllCategoriesImg.setItemCommandListener(handler);
		deleteAllExpenseImg.setItemCommandListener(handler);
		pieChartIMG.setItemCommandListener(handler);

		this.append(categoryImg);
		this.append("Category Entry\n");
		
		this.append(expenseImg);
		this.append("Expense Entry\n");
		
		this.append(reportImg);
		this.append("View Report\n");
		
		this.append(expenseSummaryImg);
		this.append("Expense Summary\n");
		
		this.append(pieChartIMG);
		this.append("Pie Chart\n");
		
		this.append(deleteAllCategoriesImg);
		this.append("Clear All Categories\n");
		
		this.append(deleteAllExpenseImg);
		this.append("Clear All Expenses");
	}
	
	public Command getCategoryEntryCMD() {
		return categoryEntryCMD;
	}
	
	public Command getExpenseEntryCMD() {
		return expenseEntryCMD;
	}
	
	public Command getReportViewCMD() {
		return reportViewCMD;
	}
	
	public Command getDeleteAllExpensesCMD() {
		return deleteAllExpenseCMD;
	}
	
	public Command getDeleteAllCategoiesCMD() {
		return deleteAllCategoriesCMD;
	}
	
	public Command getExpenseSummaryCMD() {
		return expenseSummaryCMD;
	}
	
	public Command getPierChartCMD() {
		return pieChartCMD;
	}

}
